package com.rd.student.ruanjian.class4.zhouzihe.day0731;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class TestRandom2 {
    public static void main(String[] args) {
        int[] arr = new int[50];
        for (int i = 0; i < 50; i++) {
            arr[i] = i;
        }
        System.out.println(Arrays.toString(arr));
        ArrayList<Integer> arrayList = new ArrayList<>(arr.length);
        for (int i = 0; i < arr.length; i++) {
            arrayList.add(arr[i]);
        }
        Collections.shuffle(arrayList);
        for (int i = 0; i < 20; i++) {
            System.out.println(arrayList.get(i));
        }
    }
}
